package com.cn.netty.customize.client;

import com.cn.netty.customize.BusinessMeassage;
import com.cn.netty.customize.BusinessMessageType;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.IdleStateEvent;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class HearBeatReqHandler extends ChannelInboundHandlerAdapter {

  @Override
  public void userEventTriggered(ChannelHandlerContext ctx, Object evt){
    if(evt instanceof IdleStateEvent){
      ChannelFuture channelFuture = ctx.writeAndFlush(BusinessMessageType.buildHeartBeatReq());
    }
  }


}
